import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import { post } from '../../service/api'

import './index.scss'



class StoreList extends Component {
  constructor() {
    super(...arguments)
    this.state = {
      List: []
    }
  }
  config = {
    navigationBarTitleText: '适用门店',
  }
  async getList() {
    const { data } = await post('company/findPageList', {
      pageSize: 68
    })
    if (data.code == 0) {
      this.setState({
        List: data.rows
      })
    }
  }
  componentDidMount() {
    this.getList()
  }
  render() {

    return (
      <View className='store-box'>
        <View className="store-title">适用门店</View>
        <View className="store-list">
          {this.state.List.map(item => {
            return (
              <View className="store-item" key={item.id}>
                <View className="store-item-name">{item.name}</View>
                <View className="store-item-address">{item.address ? item.address : ""}</View>
              </View>
            )
          })}

        </View>
      </View>
    )
  }
}

export default StoreList
